#include "UnknownElement.h"

namespace OpenNano
{
    REGISTER_OBJECT_FACTORY( UnknownElement, UNKNOWN_ELEMENT );

    UnknownElement::UnknownElement(TiXmlElement * element) :
                        ConfigElement(element), logger(log4cplus::Logger::getInstance( UNKNOWN_ELEMENT ))
    {
    }

    UnknownElement::~UnknownElement()
    {
    }

    void UnknownElement::init()
    {
        LOG4CPLUS_INFO(logger, "Unknown element: initialized");
    }

    void UnknownElement::attributeFound(TiXmlAttribute * attribute)
    {
        //attribute not recognized
        LOG4CPLUS_WARN(logger, "Attribute not recognized:");
        LOG4CPLUS_WARN(logger, attribute->NameTStr());

        unknownAttributeFound(attribute);
    }

    void UnknownElement::childElementFound(TiXmlElement * childElement)
    {
        //Element not recognized
        LOG4CPLUS_WARN(logger, "Child element not recognized:");
        LOG4CPLUS_WARN(logger, childElement->ValueStr());

        unknownElementFound(childElement);
    }

    void UnknownElement::textFound(const char * text)
    {
        LOG4CPLUS_WARN(logger, "Text not recognized:");
        LOG4CPLUS_WARN(logger, text);

        unknownTextFound(text);
    }

    bool UnknownElement::postConfiguration()
    {
        return true;
    }

}
